package com.zryc.shop.sms.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.zryc.shop.sms.entity.FlashPromotionSession;
import com.zryc.shop.sms.mapper.FlashPromotionSessionMapper;
import com.zryc.shop.sms.service.IFlashPromotionSessionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 限时购场次表 服务实现类
 * </p>
 *
 * @author zhaozhao
 * @since 2024-01-18
 */
@Service
public class FlashPromotionSessionServiceImpl extends ServiceImpl<FlashPromotionSessionMapper, FlashPromotionSession> implements IFlashPromotionSessionService {

    /**
     * 更新秒杀时间段
     *
     * @param id
     * @param session
     * @return
     */
    @Override
    public Object updateTime(Long id, FlashPromotionSession session) {
        UpdateWrapper<FlashPromotionSession> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("id",id);
        baseMapper.update(session,updateWrapper);
        return null;
    }

    /**
     * 修改状态
     *
     * @param id
     * @param status
     * @return
     */
    @Override
    public Object updateStatus(Long id, Integer status) {
        UpdateWrapper<FlashPromotionSession> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("id", id);
        updateWrapper.set("status", status);
        update(updateWrapper);
        return null;
    }

    /**
     * 查询活动对应的时间段列表
     *
     * @param flashPromotionId
     * @return
     */
    @Override
    public Object selectList(Long flashPromotionId) {
        return baseMapper.select(flashPromotionId);
    }
}
